#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int a, b;
    int* a_div = NULL, *b_div = NULL;
    scanf("%d %d", &a, &b);
    int a_index = 0, b_index = 0;
    int* _a_div = (int *)realloc(a_div, a);
    if (_a_div == NULL)
    {
        perror("realloc faild ::");
        exit(-1);
    }
    a_div = _a_div;
    memset(a_div, '#', a);

    int* _b_div = (int *)realloc(b_div, b);
    if (_b_div == NULL)
    {
        perror("realloc faild ::");
        exit(-1);
    }
    b_div = _b_div;
    memset(b_div, '#', b);
    
    //将求出来的公约数全部放入相应的数组中
    for (int i = 1; i <= a; ++i)
    {
        if (a % i == 0)
            a_div[a_index++] = i;
    }
    for (int i = 1; i <= b; ++i)
    {
        if (b % i == 0)
            b_div[b_index++] = i;
    }
    int a_i = 0, b_i = 0;
    int max = 0;
       for(a_i = 0; a_i < a_index; ++a_i)
       {
           while(b_i < b_index)
           {
                if (a_div[a_i] == b_div[b_i])
                {
                    max = a_div[a_i];
                    break;
                }
                b_i++;
           }
           b_i = 0;
       }
       printf("max = %d\n", max);
       printf("min = %d", a * b / max);
    return 0;
}
